//
//  ViewController.m
//  JZViewDemo
//
//  Created by wangjingfei on 2017/9/4.
//  Copyright © 2017年 wangjingfei. All rights reserved.
//

#import "ViewController.h"
#import <Masonry.h>
#import "JZButtonPlacementListView.h"
#import "JZButtonItemModel.h"

@interface ViewController ()<JZButtonClickDelegate>

@property (nonatomic,strong)NSMutableArray *dataArray;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    self.view.backgroundColor = [UIColor redColor];
    
    _dataArray = [NSMutableArray array];
    
    JZButtonItemModel *itemModel0 = [[JZButtonItemModel alloc] init];

    itemModel0.btnDisplayType = JZButtonDisplayTypeExceptional;
    
    [_dataArray addObject:itemModel0];
    
    JZButtonItemModel *itemModel1 = [[JZButtonItemModel alloc] init];
    itemModel1.btnDisplayType = JZButtonDisplayTypeThumbUp;
    [_dataArray addObject:itemModel1];
    
    UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 50)];
    bgView.backgroundColor = [UIColor whiteColor];
    
    JZButtonPlacementListView *buttonListView = [[JZButtonPlacementListView alloc] initWithFrame:CGRectZero withButtonItem:_dataArray];
    buttonListView.backgroundColor = [UIColor greenColor];
    buttonListView.delegate = self;
    buttonListView.leftView = bgView;
    buttonListView.btnSpace = 20.0f;
    [self.view addSubview:buttonListView];
    
    [buttonListView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.view.mas_left).mas_offset(0);
        make.top.mas_equalTo(self.view.mas_top).mas_offset(100);
        make.right.mas_equalTo(self.view.mas_right).mas_offset(0);
        make.height.mas_equalTo(100);
    }];
    
    [buttonListView modifyTheWordImageOnTheButton:@"11" withButtonImage:@"wjf_dynamic_24" withButtonTitleColor:[UIColor redColor] withCurrentButtonType:JZButtonDisplayTypeExceptional];
}
#pragma mark -JZButtonClickDelegate
- (void)clickButton:(JZThumbUpButton *)selectBtn withClickButtonType:(JZButtonDisplayType)buttonDisplayType
{
    if (buttonDisplayType == JZButtonDisplayTypeExceptional) {
        NSLog(@"打赏");
        [selectBtn selectCurrentBtnImgChange:@"wjf_dynamic_24"];
    }else if (buttonDisplayType == JZButtonDisplayTypeSendGifts){
        NSLog(@"送礼物");
    }else if (buttonDisplayType == JZButtonDisplayTypeComment){
        NSLog(@"评论");
    }else if (buttonDisplayType == JZButtonDisplayTypeThumbUp){
        NSLog(@"点赞");
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
